# encoding: utf-8
# @project: st2111 
# @file: re_groups_individual.py
# @time: 2023/4/13 14:35
# @author: abcque
# @license: (C) Copyright 2013-2021
# @contact: abcque@outlook.com
# @IDE: PyCharm
# @desc:
import re

if __name__ == "__main__":
    text = 'This is some text -- with punctuation.'
    print('Input text            :', text)
    # word starting with 't' then another word
    regex = re.compile(r'(\bt\w+)\W+(\w+)')
    print('Pattern               :', regex.pattern)

    match = regex.search(text)
    print('Entire match          :', match.group(0))
    print('Word starting with "t":', match.group(1))
    print('Word after "t" word   :', match.group(2))
